<template>
  <div>
    <slot name="title" :title="title">
      <div class="description-title" v-if="title">{{ title }}</div>
    </slot>
    <el-row :gutter="gutter" type="flex" class="description-row">
      <el-col
        :span="item.$span || span"
        v-for="item in items"
        :key="item.label"
      >
        <slot :item="item">
          <div class="description-col">
            <span class="description-label">{{ item.label }}</span>
            <span class="description-text">{{ item.text }}</span>
          </div>
        </slot>
      </el-col>
    </el-row>
  </div>
</template>
<script>
export default {
  props: {
    gutter: {
      type: Number,
      default: 20
    },
    span: {
      type: Number,
      default: 8
    },
    title: {
      type: String,
      default: null
    },
    items: {
      type: Array,
      default: () => []
    }
  },
  data() {
    return {};
  }
};
</script>
<style scoped>
.description-title {
  margin-bottom: 20px;
  color: rgba(0, 0, 0, 0.85);
  font-weight: 700;
  font-size: 16px;
  line-height: 1.5;
}
.description-row {
  flex-wrap: wrap;
}
.description-col {
  display: flex;
  margin-bottom: 16px;
  font-size: 14px;
  font-weight: 400;
}
.description-label {
  flex: 0 0 auto;
  color: rgba(0, 0, 0, 0.85);
  line-height: 1.5;
  white-space: nowrap;
}
.description-label::after {
  content: ":";
  position: relative;
  top: -0.5px;
  margin: 0 8px 0 2px;
}
.description-text {
  flex: 1 1 auto;
  color: rgba(0, 0, 0, 0.65);
  line-height: 1.5;
}
</style>
